<?xml version="1.0"?>
<jsp:root 	xmlns:jsp="http://java.sun.com/JSP/Page"
			xmlns:sql="http://java.sun.com/jsp/jstl/sql"
			xmlns:c="http://java.sun.com/jsp/jstl/core" 
			xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
			version="2.1">
	<jsp:directive.page contentType="text/html; charset=UTF-8" />
	<jsp:directive.page isELIgnored="false" />
	<jsp:output omit-xml-declaration="false"
		doctype-root-element="html"
		doctype-public="-//W3C//DTD XHTML 1.1//EN"
		doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml11.dtd" /> 	
		
	<jsp:useBean id="userBean" class="es.albarregas.beans.UserBean" scope="session" />	
	

	
<!--[if lt IE 8]>      <html class="no-js lt-ie10 lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie10 lt-ie9"> <![endif]-->
<!--[if IE 9]>         <html class="no-js lt-ie10"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
  <head>
    <meta charset="utf-8" />
    <title>Ikex | Dirección</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="description" content="Ikex Furniture Store" />
    <meta name="author" content="Josu Becerra" />
    
    <jsp:useBean id="provinciasList" class="es.albarregas.beans.ProvinciasListBean" scope="session" />

	<!-- Favicon y Apple touch icons (botones para Ipad y Iphone) -->
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="images/apple-touch/144.png" ></link>
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="images/apple-touch/114.png" ></link>
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="images/apple-touch/72.png" ></link>
    <link rel="apple-touch-icon-precomposed" href="images/apple-touch/57.png" ></link>
    <link rel="shortcut icon" href="images/favicon.png" ></link>

    <!--  Google Fonts  -->
    <link href='http://fonts.googleapis.com/css?family=Pacifico|Open+Sans:400,700,400italic,700italic&amp;subset=latin,latin-ext,greek' rel='stylesheet' type='text/css' />
    
    
    <!-- Twitter Bootstrap; librería ventanas JQuery-->
    <link href="css/bootstrap.css" rel="stylesheet" ></link>
    <link href="css/responsive.css" rel="stylesheet" ></link>
    <!-- Slider Revolution -->
    <link rel="stylesheet" href="js/rs-plugin/css/settings.css" type="text/css" ></link>
    <!-- jQuery UI -->
    <link rel="stylesheet" href="js/jquery-ui-1.10.3/css/smoothness/jquery-ui-1.10.3.custom.min.css" type="text/css" ></link>
    <!-- PrettyPhoto -->
    <link rel="stylesheet" href="js/prettyphoto/css/prettyPhoto.css" type="text/css" ></link>
    <!-- main styles -->
     
    <link href="css/main.css" rel="stylesheet" ></link>
     
     <!-- JQuery -->
	<!-- <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> -->
	<script type="text/javascript" src="js/jquery.min.js"><jsp:text /></script>

    <!-- Modernizr, librería que le dice al navegador cómo actuar si no soporta la funcionalidad de la página 
    <script src="js/modernizr.custom.56918.js"></script>    -->
 	
  	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  	
  	<script type='text/javascript' src='${pageContext.request.contextPath}/app/interface/Address.js'><jsp:text /></script>
  	<script type='text/javascript' src='${pageContext.request.contextPath}/app/engine.js'><jsp:text /></script>
  	<script type="text/javascript" src="${pageContext.request.contextPath}/js/address.js"><jsp:text /></script>
  
  </head>

   
  <body class="checkout-page">
   
    
   <!-- Carrito  -->
	<jsp:useBean id="listaPedidosBean" class="es.albarregas.beans.PedidoListBean" scope="session" />
	
	<jsp:setProperty property="clausulaWhere" name="listaPedidosBean" value="where user_oid=${userBean.oid} and confirmado=false" />
	  
	<c:if test="${userBean.oid != 0}">
		<c:set var="clausula" 	value=" where user_oid=${userBean.oid} and confirmado=false" />
		<jsp:setProperty property="clausulaWhere" name="listaPedidosBean" value="${clausula}" />
		<c:set var="oidPedido" value="0" />
		<c:set var="totalPedido" value="0"></c:set>
		<c:forEach var="registros" items="${listaPedidosBean.pedido}">
			<c:set var="oidPedido" value="${registros.oid}" />
			<c:set var="totalPedido" value="${registros.total }"></c:set>
			<c:set var="elPedido" value="${registros}"></c:set>
		</c:forEach>
		<c:if test="${oidPedido != 0}">
			<jsp:useBean id="listaLineasPedidoBean" class="es.albarregas.beans.LineasPedidoListBean" scope="session" />
			<c:set var="clausula2" value="where pedido_oid=${oidPedido}" />	
			<jsp:setProperty property="clausulaWhere" name="listaLineasPedidoBean" value="${clausula2}" />
		</c:if>		
    </c:if>  
    
   	<jsp:useBean 
      id="direccionBean"
      class="es.albarregas.beans.DireccionBean"
      scope="session">  
    </jsp:useBean>
    <jsp:setProperty name="direccionBean" property="*" />
    
    <jsp:useBean 
      id="tarjetaBean"
      class="es.albarregas.beans.TarjetaBean"
      scope="session">  
    </jsp:useBean>
    <jsp:setProperty name="tarjetaBean" property="*" />
    
    <div class="container">
        <div class="row">
        	            
            <!--  ==========  -->
            <!--  = Main content =  -->
            <!--  ==========  -->
            <section class="span12">
                
                <div class="checkout-container">
                    <div class="row">
                    	<div class="span10 offset1">
                    	    
                    	    <!--  ==========  -->
							<!--  = Header =  -->
							<!--  ==========  -->
                    		<header>
                    		    <div class="row">
                    		    	<div class="span2">
                    		    		<a href="index.jsp"><img src="images/logo-ikex.png" alt="Ikex Logo" title="Volver a Inicio" width="100px" /><jsp:text /></a><br/>
                    		    		<a href="index.jsp">Seguir comprando</a>
                    		    	</div>
                    		    	<div class="span6">
                    		    	    <div class="center-align">
                    		    	        <h1><span class="light">Dirección</span> de Envío</h1>
                    		    	    </div>
                    		    	</div>
                    		    	<div class="span2">
                    		    	    <div class="right-align">
                    		    	    	<img src="images/buttons/security.jpg" alt="Authentic secure" width="92" height="65" />
                    		    	    </div>
                    		    	</div>
                    		    </div>
                    		</header>
                    		
                    		<!--  ==========  -->
							<!--  = Steps =  -->
							<!--  ==========  -->
                    		<div class="checkout-steps">
                    		    <div class="clearfix">
                    		    	<div class="step done">
                    		    	    <div class="step-badge"><i class="icon-ok"><jsp:text /></i></div>
                    		    	    <a href="carrito.jsp">Revisar Carrito</a>
                    		    	</div>
                    		    	<div class="step active">
                    		    	    <div class="step-badge">2</div>
                    		    	    Dirección de Envío
                    		    	</div>
                    		    	<div class="step">
                                        <div class="step-badge">3</div>
                                        Método de Pago
                                    </div>
                    		    	<div class="step">
                    		    	    <div class="step-badge">4</div>
                    		    	    Confirmar y Pagar
                    		    	</div>
                    		    </div>
                    		</div> <!-- /steps -->
                    		
						    <!--  =======================  -->
							<!--  = Formulario de envío =  -->
							<!--  =======================  -->
							    
						    <form  name="direccionForm" action="pago.jsp" method="post" class="form-horizontal form-checkout" id="direccionForm">
                                <div class="control-group">
                                    <label class="control-label" for="nombre">Nombre<span class="red-clr bold">*</span></label>
                                    <div class="controls">
                                        <input type="text" id="nombre" name="nombre" class="span4" value="${direccionBean.nombre }" />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label" for="apellidos">Apellidos<span class="red-clr bold">*</span></label>
                                    <div class="controls">
                                        <input type="text" id="apellidos" name="apellidos" class="span4"  value="${direccionBean.apellidos }" />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label" for="telefono">Teléfono<span class="red-clr bold">*</span></label>
                                    <div class="controls">
                                        <input type="tel" id="telefono" name="telefono" class="span4"  value="${direccionBean.telefono }" />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label" for="email">Email<span class="red-clr bold">*</span></label>
                                    <div class="controls">
                                        <input type="email" id="email" name="email" class="span4"  value="${direccionBean.email }" />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label" for="direccion">Dirección<span class="red-clr bold">*</span></label>
                                    <div class="controls">
                                        <input type="text" id="direccion" name="direccion" class="span4"  value="${direccionBean.direccion }" />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label" for="codigoPostal">Código postal<span class="red-clr bold">*</span></label>
                                    <div class="controls">
                                        <input type="text" id="codigoPostal" onkeyup="loadData(this.value)" name="codigoPostal" class="span4" value="${direccionBean.codigoPostal }"/>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label" for="poblacion">Población<span class="red-clr bold">*</span></label>
                                    <div class="controls">
                                        <input type="text" id="poblacion" name="poblacion" class="span4" value="${direccionBean.poblacion }" />
                                    </div>
                                </div>
                                
                                
                                <!--  ==============  -->
                                <!--  = Provincias =  -->
                                <!--  ==============  -->
                                <div class="control-group">
                                    <label class="control-label" for="provincia">Provincia<span class="red-clr bold">*</span></label>
                                    <div class="controls">
                                        <select id="provincias" class="as-span4" name="provincia"><!-- onchange="loadMunicipio()" -->
                                        	<option value="">--Selecciona Provincia--</option>
                                        	<c:forEach var="provincia" items="${provinciasList.provincias}" >
                                        		<c:choose>
                      								<c:when test="${provincia.nombre == direccionBean.provincia}">
														<option value="${provincia.nombre}" selected="selected">${provincia.nombre}</option>
													</c:when>
													<c:otherwise>
														<option value="${provincia.nombre}">${provincia.nombre}</option>
													</c:otherwise>
												</c:choose>
											</c:forEach>
                                       	</select>
                                    </div>
                                </div> <!-- /provincias -->							
                            <hr />
						    
						    <p class="right-align">
						       <span style="margin-right: 10px;">En el próximo paso se elegirá el método de pago </span>
						        <input type="submit" class="btn btn-primary higher bold" value="CONTINUAR" />
						    </p>
							</form>    
                    	</div>
                    </div>
                </div>
                
                
            </section> <!-- /main content -->
        
        </div>
    </div> <!-- /container -->
    
     
    
     
    


    <!--  ==========  -->
    <!--  = JavaScript =  -->
    <!--  ==========  -->
    <jsp:include page="include/js.jsp" />
    
    <!-- Scripts de validación JavaScript -->
	<script src="js/validacion.js"><jsp:text /></script> 

  </body>
</html>
</jsp:root>
    
    